package com.xxjd.config.converter;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import org.springframework.core.convert.converter.Converter;

import java.util.Date;

/**
 * @author hanxy
 * @ClassName DateConverter
 * @description: TODO
 * @date 2021/7/27 21:22
 */
public class DateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String dateStr) {
        if (StrUtil.isBlank(dateStr)) {
            return null;
        }
        dateStr = dateStr.trim();
        return DateUtil.parse(dateStr);
    }

}